use static const QRegularExpressions in GUI.
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Sat, 19 Mar 2022 18:38:38 +0000 (12:38 -0600)
committertsteven4 <13596209+tsteven4@users.noreply.github.com>
Sat, 19 Mar 2022 18:38:38 +0000 (12:38 -0600)
gui/formatload.cc
gui/help.cc

index 9f39df6c5882a425af62db8378fe4fc54f7d4ebd..7f414846b5ae1819750dfff36beaac92527e2e7f 100644 (file)
@@ -52,7 +52,7 @@ static QString xlt(const QString& f)
 //------------------------------------------------------------------------
 bool FormatLoad::skipToValidLine()
 {
-  QRegularExpression regex("^file|serial");
+  static const QRegularExpression regex("^file|serial");
   while ((currentLine_ < lines_.size()) && !regex.match(lines_[currentLine_]).hasMatch()) {
     currentLine_++;
   }
@@ -127,7 +127,8 @@ bool FormatLoad::processFormat(Format& format)
 #ifndef GENERATE_CORE_STRINGS
   if (htmlPage.length() > 0 && Format::getHtmlBase().length() == 0) {
     QString base = htmlPage;
-    base.replace(QRegularExpression("/[^/]+$"), "/");
+    static const QRegularExpression re("/[^/]+$");
+    base.replace(re, "/");
     Format::setHtmlBase(base);
   }
 #endif
index bf05187d07f4d2d5ddf20eb4f0241cd6d0a1e764..cc169d735cf2b58d033abf52c3713f826b90bb59 100644 (file)
@@ -34,7 +34,8 @@ void ShowHelp(const QString& urlIn)
 
 {
   QString url = urlIn;
-  if (!url.contains(QRegularExpression(R"(^https?://)"))) {
+  static const QRegularExpression re(R"(^https?://)");
+  if (!url.contains(re)) {
     url = Format::getHtmlBase() + url;
   }
   QDesktopServices::openUrl(QUrl(url));